View Javadoc

1   /*
2    * Copyright (c) 2004-2005, University Health Network.  All rights reserved. Distributed under the BSD 
3    * license (see http://opensource.org/licenses/bsd-license.php).
4    *  
5    * Created on 4-Jan-2005
6    */
7   package ca.uhn.cache.internal;
8   
9   /***
10   * Determiner of how likely it is that a chunk will be used in the near future.  
11   * 
12   * @author <a href="mailto:bryan.tripp@uhn.on.ca">Bryan Tripp</a>
13   * @version $Revision: 1.1 $ updated on $Date: 2005/01/24 22:53:27 $ by $Author: bryan_tripp $
14   */
15  public interface IUnusedChunkRule {
16  
17      /***
18       * For use with the least-recently-used (LRU) mode of cache eviction.  
19       * 
20       * By default, if the cache gets too full, the least recently used chunks are evicted until 
21       * the cache is small enough (LRU means chunks with last access times the farthest in the past). 
22       * Sometimes this isn't optimal.  For example, a chunk may be cached because it will definitly be 
23       * used in the next 30 minutes, but may be evicted after 20 minutes while other single-use chunks 
24       * remain cached.  
25       * 
26       * This method defines a modifier on last access time, to account for special circumstances.  
27       * This allows us to change the LRU rule from "evict if last_access_time less than x" to 
28       * "evict if (last_access_time + modifier) less than x", which is more flexible.  The resulting 
29       * index (i.e. last_access_time + modifier) we call vogueness.  
30       *   
31       * @param theChunk a chunk to be cached 
32       * @return the time (ms) by which to shift the last access time when evaluating for eviction   
33       */
34      public long getVoguenessModifier(IChunk theChunk);
35      
36  }